//	ID : pallab81
// 	PROG : 10496
// 	LANG : C++
// 	2011-09-02-14.43.27 Friday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ) {
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}
int R,C;
pair< int , int > me;
int nbeep;
vector< pair<int,int> > beepers;
vector< int > Bdist; // beepers distance
vector< VI > dist;

int cost[ 21 ][ 21 ];
int move[4][2]={ {0,-1},{0,+1},{-1,0},{+1,0} };
inline void Read(){
        CI(R);
        CI(C);
        CI(me.first);
        CI(me.second);
        me.first--;
        me.second--;

        CI(nbeep);
        beepers.assign(nbeep, mk(0,0) );
        fo(i,0,nbeep){
            CI( beepers[i].f );
            CI( beepers[i].s );
            beepers[i].f--;
            beepers[i].s--;
        }
}
inline int bfs(pair< int , int > source, pair<int,int> sink ){
    if( source==sink ){
        return 0;
    }
    //initialized
    fo(i,0,20){
        fo(j,0,20){
            cost[i][j] = (int)1023456789;
        }
    }

    queue< pair<int,int> > q;
    q.push( source );
    cost[ source.f ][ source.s ]=0;
    while( q.empty()==false ){
        int r = q.front().f;
        int c = q.front().s;
        q.pop();

        fo(i,0,4){
            int tr = r+move[i][0];
            int tc = c+move[i][1];
            if(tr<0 || tc < 0 || tr >=R || tc>=C )continue;
            if( cost[r][c]+1 < cost[tr][tc] ){
                q.push( mk(tr,tc) );
                cost[tr][tc]=cost[r][c]+1;
            }
        }
    }
return cost[sink.f][sink.s];
}
inline void Proc(){
    // source theke sob beeper er distance
    Bdist.clear();
    fo(i,0,nbeep){
        Bdist.pb( bfs(me, beepers[i]) );
    }

    dist.assign(nbeep, VI(nbeep,0) );
    //beeper to beeper distances
    fo(i,0,nbeep){
        fo(j,i+1,nbeep){
            dist[i][j]=dist[j][i]=bfs( beepers[i], beepers[j] );
        }
    }

    VI p;
    fo(i,0,nbeep){
        p.pb(i);
    }

    int mn = -1;
    do{
        int total=Bdist[ p[0] ];
        fo(i,1,nbeep){
            int temp = dist[ p[i] ][ p[i-1] ] ;
            total+=temp;
        }
        total+=Bdist[ p[nbeep-1] ];
        if(mn==-1 || total<mn){
            mn=total;
        }
    }while( next_permutation(p.begin(),p.end()) );
    printf("The shortest path has length %d\n",mn);
}
int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt","rt",stdin);
//#endif

    int cases=1;
    for( CI(cases) ; cases ; --cases ) {
        Read();
        Proc();
    }

    return 0;
}
